<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1.0">
    <title>学生介绍录入</title>

    <link rel="stylesheet" href="./node_modules/layui/dist/css/layui.css" media="all" />
    <script type="text/javascript" src="./node_modules/layui/dist/layui.js"></script>
    <script type="text/javascript" src="./node_modules/jquery/dist/jquery.min.js"></script>
    <script type="text/javascript" src="./js/config.js"></script>
</head>
<body>
    <form class="layui-form">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px; color: darkblue;">
            <legend>基本信息（必填）</legend>
        </fieldset>
    
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">部门</label>
                <div class="layui-input-inline">
                    <select id="deptcode" name="dept">
                        <option value="0">请选择</option>
                        <option value="1">教务处</option>
                        <option value="2">学生处</option>
                        <option value="3">市场部</option>
                        <option value="4">人力资源部</option>
                        <option value="5">财务部</option>
                    </select>
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">毕业生</label>
                <div class="layui-input-inline">
                    <input type="text" id="gstudent" name="gstudent" autocomplete="off" placeholder="姓名" class="layui-input">
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">教师</label>
                <div class="layui-input-inline">
                <input type="text" id="hteacher" name="hteacher" autocomplete="off" placeholder="姓名" class="layui-input">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">班级名称</label>
                <div class="layui-input-inline">
                    <input type="text" id="gclass" name="gclass" autocomplete="off" placeholder="名称" class="layui-input">
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">联系方式</label>
                <div class="layui-input-inline">
                    <input type="text" id="mbphone" name="mbphone" autocomplete="off" placeholder="电话" class="layui-input">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">联系方式</label>
                <div class="layui-input-inline">
                    <input type="text" id="gstudentphone" name="gstudentphone" autocomplete="off" placeholder="电话" class="layui-input">
                </div>
            </div>
        </div>

        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px; color: darkblue;">
            <legend>被介绍学生信息（必填）</legend>
        </fieldset>
    
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">潜在学生</label>
                <div class="layui-input-inline">
                    <input type="text" id="pstudent" name="pstudent" autocomplete="off" placeholder="姓名" class="layui-input">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">是否回访</label>
                <div class="layui-input-inline">
                    <select ="cflag" id="cflag" name="cflag">
                        <option value="0">否</option>
                        <option value="1">是</option>
                    </select>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">联系方式</label>
                <div class="layui-input-inline">
                    <input type="text" id="pstudentphone" name="pstudentphone" autocomplete="off" placeholder="电话" class="layui-input">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">直播参观</label>
                <div class="layui-input-inline">
                    <select id="vflag" name="vflag">
                        <option value="0">否</option>
                        <option value="1">是</option>
                    </select>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">地区</label>
                <div class="layui-input-inline">
                    <input type="text" id="district" name="district" autocomplete="off" placeholder="地区信息" class="layui-input">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">预计到校</label>
                <div class="layui-input-inline">
                    <input type="text" id="pentertime" name="pentertime" id="pentertime" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">咨询师</label>
                <div class="layui-input-inline">
                    <input type="text" id="cteacher" name="cteacher" autocomplete="off" placeholder="姓名" class="layui-input">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">处理结果</label>
                <div class="layui-input-inline">
                    <select id="rst" name="rst">
                        <option value="0">初始</option>
                        <option value="1">无效</option>
                        <option value="2">跟进</option>
                        <option value="3">有效</option>
                        <option value="4">重复</option>
                    </select>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">联系方式</label>
                <div class="layui-input-inline">
                    <input type="text" id="ctmbphone" name="ctmbphone" autocomplete="off" placeholder="电话" class="layui-input">
                </div>
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block" style="margin-right: 10px;">
                <textarea id="cbrief" name="cbrief" placeholder="请输入内容" class="layui-textarea"></textarea>
            </div>
        </div>
    </form>

    <div class="layui-input-block">
        <button id="btnSubmit" class="layui-btn">提交</button>
    </div>

    <blockquote id="myMessage" class="layui-elem-quote" style="margin-top: 30px;">
        请严格按真实数据填写，一经填写不可更改
    </blockquote>

    <script>
        $(document).ready(() => {
            layui.form.render("select");
            layui.laydate.render({
                elem: "#pentertime"
            });

            $("#btnSubmit").on("click", () => {
                let formData = new FormData();

                let deptcode = $("#deptcode").val();
                let gstudent = $("#gstudent").val();
                let hteacher = $("#hteacher").val();
                let gclass = $("#gclass").val();
                let mbphone = $("#mbphone").val();
                let gstudentphone = $("#gstudentphone").val();
                let pstudent = $("#pstudent").val();
                let cflag = $("#cflag").val();
                let pstudentphone = $("#pstudentphone").val();
                let vflag = $("#vflag").val();
                let district = $("#district").val();
                let pentertime = $("#pentertime").val();
                let cbrief = $("#cbrief").val();
                let cteacher = $("#cteacher").val();
                let ctmbphone = $("#ctmbphone").val();
                let rst = $("#rst").val();

                formData.append("rst", rst)
                formData.append("ctmbphone", ctmbphone)
                formData.append("cteacher", cteacher)
                formData.append("cbrief", cbrief);
                formData.append("pentertime", pentertime);
                formData.append("district", district);
                formData.append("vflag", vflag);
                formData.append("pstudentphone", pstudentphone);
                formData.append("cflag", cflag);
                formData.append("pstudent", pstudent);
                formData.append("gstudentphone", gstudentphone);
                formData.append("mbphone", mbphone);
                formData.append("gclass", gclass);
                formData.append("hteacher", hteacher);
                formData.append("gstudent", gstudent);
                formData.append("deptcode", deptcode);

                let myUrl = apiurl + "/reg/infointro/new";

                $.ajax({
                    url: myUrl,
                    type: 'POST',
                    cache: false,
                    data: formData,
                    processData: false,
                    contentType: false
                }).done(function (res) {
                    let d = new Date();
                    $("#myMessage").text("请严格按真实数据填写，一经填写不可更改" + " 提交成功 " + d.toGMTString());
                }).fail(function (res) {
                    let d = new Date();
                    $("#myMessage").text("请严格按真实数据填写，一经填写不可更改" + " 提交失败 " + d.toGMTString());
                });

            });
        });
    </script>
</body>
</html>